<template>
    <div class="error">
        <img src="@/static/images/404.png" class="img">
        <div class="text">
          <h1>{{error.statusCode}}</h1>
          <div v-if="error.statusCode == 404" class="tips">页面不存在，点击返回上一页或返回首页</div>
          <div v-else-if="error.statusCode == 500" class="tips">服务器错误({{error.message}})，点击返回上一页或返回首页</div>
          <div v-else-if="error.statusCode == 502" class="tips">网络错误，点击返回上一页或返回首页</div>
          <div v-else-if="error.statusCode == 503" class="tips">服务不可用，点击返回上一页或返回首页</div>
          <div v-else-if="error.statusCode == 504" class="tips">网络超时，点击返回上一页或返回首页</div>
          <div v-else class="tips">未知错误，点击返回上一页或返回首页</div>
          <!-- <div class="tips">{{error.message}}</div> -->
          <div class="back">
            <el-button @click="goBack">返回上一页</el-button>
            <el-button type="primary" @click="goHome">返回首页</el-button>
          </div>
        </div>
    </div>
</template>

<script>
export default {
    props:['error'],
    data() {
      return{
        statusCode: 404,
        errorTips: ''
      }
    },
    created() {
      console.log(this.error)
    },
    methods: {
    	goBack() {
    		this.$router.go(-1)
    	},
      goHome(){
        this.$router.push({
          path: '/'
        })
      }
    }
}
</script>

<style lang="scss" scoped="scoped">
  .error{
    display: flex;
    padding: 80px 20%;
    height: 100vh;
    box-sizing: border-box;
    align-content: center;
    align-items: center;
    justify-content: center;
    .img{
      width: 300px;
    }
    .text{
      padding-left: 50px;
      h1{
        color: var(--main);
        font-size: 140px;
        margin: 0;
      }
      .tips{
        margin-bottom: 30px;
        font-size: 18px;
        color: var(--gray);
      }
      .back{
        .span{
          color: #000;
        }
      }
    }
  }
</style>
